﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace ProCP.Sim
{
    [Serializable()]
    class Road
    {
        //ToDraw
        //Rectangle rRoad;

        //logic 
        public LaneIn[] lanesIn;
        public LaneOut[] lanesOut;
        public int trafficIn;
        public float trafficOut ;
        private int width;
        public Road(int laneWidth,int nrOfInLanes,int nrOfOutLanes) 
        {
            lanesIn = new LaneIn[nrOfInLanes];
            lanesOut = new LaneOut[nrOfOutLanes];

            width = laneWidth;
        }

        public void addLaneIn(int turns, Point entery, Point decision)
        {
            for (int i = 0; i < lanesIn.Length; i++)
            {
                if (lanesIn[i] == null)
                {
                    lanesIn[i] = new LaneIn(width,turns,entery,decision);
                    return;
                }
            }
        }

        public void addlaneOut(Point entery, Point decision)
        {
            for (var i = 0; i < lanesOut.Length; i++)
            {
                if (lanesOut[i] == null)
                {
                    lanesOut[i] = new LaneOut(width, entery, decision);
                }
            }
        }

        public int GetNrOfInLanes() 
        {
            return lanesIn.Length;
        }

        public int GetNrOfOutLanes()
        {
            return lanesOut.Length;
        }
    }
}
